<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s"  uri="/struts-tags" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
   	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
	<title>商品详情管理</title>
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet" type="text/css">
    <script src="<%=request.getContextPath()%>/js/jquery-2.0.3.min.js" type="text/javascript"></script>
    <script src="<%=request.getContextPath()%>/js/bootstrap.js" type="text/javascript"></script>
    <script src="<%=request.getContextPath()%>/js/jquery.twbsPagination.js" type="text/javascript"></script>   
    <script type="text/javascript">

    $(document).ready(function () {
	    $('#pagination-demo').twbsPagination({	    	
	        totalPages: ${pageCount},
	        visiblePages: ${pageCount}>10?10:${pageCount},
			startPage:${page},
	        version: '1.1',
	        first: "首页",
	        last: "未页",
	        prev: '上一页',
	        next: '下一页',
	        onPageClick: function (event, page) {	        	
	        	if(page!=${page}){
	        		var params="${params}";
	        		if(params!='choose'){
						location.href="<%=request.getContextPath()%>/product/productIntroduction_listByPage.action?page="+ page +"&rows=10";
		        		document.getElementById("queryForm").action="<%=request.getContextPath()%>/product/productIntroduction_listByPage.action?page="+ page +"&rows=10";
		        		document.getElementById("queryForm").submit();
	        		}
	        		if(params=='choose'){
   					    document.getElementById("defaultForm").action="<%=request.getContextPath()%>/product/productIntroduction_listByPage.action?params=choose&page="+ page +"&rows=10";
   					    document.getElementById("defaultForm").submit();
	        		}
	        		
	        	}	        	
	        }
	    });
    });
    
    function dele(id)
    {
    	var r=confirm("是否删除？");
    	if(r)
   		{	
   			location.href='product/productIntroduction_delete.action?id='+id;
   		}
    	
    }

    </script>
</head>

<body>
<div class="panel panel-primary">
  <div class="panel-heading">商品详情管理 </div>
  
<c:if test="${params!='choose' }">  
  <div class="panel-body"> 
  <form id="queryForm" class="form-horizontal" action="product/productIntroduction_listByPage.action" method="post">
  	
  	<table>
  		<tr>
﻿            <td>商品名称：</td>
  			<td><input type="text" value="${t1.name }" name="t1.name" class="form-control" id="input_category" placeholder="" style="width: 150px"  ></td>

  			<td><button type="submit" class="btn btn-default">查询</button></td>
  			<td><button type="button" onclick="location.href='<%=request.getContextPath()%>/product/productIntroduction_toAdd?params=add'" class="btn btn-default">增加</button></td>
  			<td><button type="button" onclick="location.href='<%=request.getContextPath()%>/product/productIntroduction_txtIntroductionHandle'" class="btn btn-default">详情批量导入</button></td>
  		</tr>
  	</table>
  	
</form>
  
  </div>
		<table class="table table-bordered table-hover">
		    <thead>
			    <tr>
			         <th>名称</th>
					 <th>创建时间</th>
					 <th>修改时间</th>
					 <th>创建人</th>
					 <th>修改人</th>

			        <th>操作</th>
			    </tr>
		    </thead>
		    
		    <s:iterator value="#list">
			    <tr>
					 <th>${name }</th>
					 <th><fmt:formatDate value="${creationTime }" pattern="yyyy-MM-dd HH:mm:ss"/></th>
					 <th><fmt:formatDate value="${updateTime }" pattern="yyyy-MM-dd HH:mm:ss"/></th>
					 <th>${creator.username }</th>
					 <th>${updater.username }</th>
			        
			        <td>
				        <a class="btn btn-primary btn-sm" href="<%=request.getContextPath()%>/product/productIntroduction_get.action?id=${id }&params=view" role="button" >查看</a>
				        <a class="btn btn-primary btn-sm" href="<%=request.getContextPath()%>/product/productIntroduction_get.action?id=${id }&params=save" role="button" >修改</a>
				        <a class="btn btn-primary btn-sm" onclick="dele(${id })" href="#" role="button" >删除</a>
			        </td>
			    </tr>        
		    </s:iterator>
		</table>
</c:if>



<c:if test="${params=='choose' }">
    <div class="panel-body"> 

		<form class="form-horizontal" id="defaultForm" action="productIntroduction_listByPage.action?params=choose" method="post">
		  	<table>
		  		<tr>
		  			<td><input type="text" name="t1.name" class="form-control" id="name" placeholder="请输入详情名称" style="width: 150px"  value="${t1.name}"></td>
		  			<td><button type="submit" class="btn btn-default">查询</button></td>
		  		</tr>
		  	</table>
		</form>
 
    </div>
  
  
        <table class="table table-bordered table-hover">
            <thead>
			    <tr>
					 <th>详情名称</th>
			         <th>操作</th>
			    </tr>
		    </thead>
		    <s:iterator value="#list">
			    <tr>
					 <th>${name}</th>
			        <th>
				        <input type="hidden" name="nameChoose" id="${id }" value="${name }"/>
						<input type="radio" name="idChoose" value="${id }"/>
			        </th>
			    </tr>        
		    </s:iterator>
		</table>  
</c:if>


</div>


<section id="main-content">
    <p>
        <div class="text-center" display="inline">
            <ul id="pagination-demo" class="pagination-sm">&nbsp;&nbsp;&nbsp;共${pageCount}页,共${recordsCount}条记录</ul>
        </div>
    </p>
</section>
  

</body>
</html>
